﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;


public partial class jinhuotuiding : System.Web.UI.Page
{
    private static string sqlconn = System.Configuration.ConfigurationManager.AppSettings["sqlcon"].ToString().Trim();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Binddate();
            
           
        }
    }
    protected void Binddate()
    {
        users us = new users();
        gvjinhuo.DataSource = us.GetAlljinhuo(us);
        gvjinhuo.DataBind();
    }
   
    protected void gvjinhuo_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvjinhuo.PageIndex = e.NewPageIndex;
        Binddate();
    }
    protected void chkAll_CheckedChanged(object sender, EventArgs e)
    {

        CheckBox chkAll = (CheckBox)sender;
        foreach (GridViewRow gvRow in gvjinhuo.Rows)
        {
            CheckBox chkItem = (CheckBox)gvRow.FindControl("chkItem");
            chkItem.Checked = chkAll.Checked;
        }
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow gvRow in gvjinhuo.Rows)
        {
            CheckBox chkItem = (CheckBox)gvRow.FindControl("chkItem");

            if (chkItem.Checked == true)
            {
                string dh = gvjinhuo.DataKeys[0].Value.ToString().Trim();
                users us = new users();
                us.dh = dh;
                us.Delete(us);
                Binddate();
            }
        }
    }
}